package com.cy3;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class BufferStreamDemo {
    public static void main(String[] args) throws IOException {
//        BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream("myByteStream\\bos.txt"));
//        bos.write("chenyong\r\n".getBytes());
//        bos.write("dashuaibi\r\n".getBytes());
//        bos.close();
        BufferedInputStream bis= new BufferedInputStream(new FileInputStream("myByteStream\\bos.txt"));
//        int by;
//        while((by=bis.read())!=-1){
//            System.out.print((char)by);
//        }
        byte [] bys=new byte[1024];
        int len;
        while((len=bis.read(bys))!=-1){
            System.out.println(new String(bys,0,len));
        }
        bis.close();
    }
}
